<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			td,table{
				border: 1px solid black;
			}
		</style>
	</head>
	<body>
		<button type="button" onclick="fun()">显示九九乘法表</button>
		
		<script type="text/javascript">
			function fun(){
				document.write("<table cellpadding='0'>")
				for (var i = 1; i <= 9; i++) {
					document.write("<tr>")
					for (var j = 1; j <= i; j++){ 
						document.write("<td bgcolor='red'>")
						document.write(i+"*"+j+"="+i*j);
						document.write("</td>")
					}
					document.write("</tr>")
				}
				document.write("</table>")
			}
		</script>
	</body>
</html>
